package com.example.leetcode.trainingcamp.week6.Sunday;

/**
 * 翻转一棵二叉树
 */
public class Test226 {

    public TreeNode invertTree(TreeNode root) {
        if (root == null) return null;
        TreeNode left = root.left;
        TreeNode right = root.right;
        root.left = right;
        root.right = left;
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
